home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / network / apple / AddressXlation.h next >
Encoding:
C/C++ Source or Header  |  1996-07-05  |  5.4 KB  |  201 lines  |  [TEXT/R*ch]

  1. /*
  2.     File:        AddressXlation.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __ADDRESSXLATION__
  13. #define __ADDRESSXLATION__
  14.  
  15. #ifndef __MACTCPCOMMONTYPES__
  16. #include <MacTCPCommonTypes.h>
  17. #endif
  18.  
  19. #define NUM_ALT_ADDRS 4
  20.  
  21. #if defined(powerc) || defined (__powerc)
  22. #pragma options align=mac68k
  23. #endif
  24. struct hostInfo {
  25.     long                        rtnCode;
  26.     char                        cname[255];
  27.     unsigned long                addr[NUM_ALT_ADDRS];
  28. };
  29. #if defined(powerc) || defined(__powerc)
  30. #pragma options align=reset
  31. #endif
  32.  
  33. typedef struct hostInfo hostInfo;
  34.  
  35. enum AddrClasses {
  36.     A                            = 1,
  37.     NS,
  38.     CNAME                        = 5,
  39.     HINFO                        = 13,
  40.     MX                            = 15,
  41.     lastClass                    = 32767
  42. };
  43.  
  44. typedef enum AddrClasses AddrClasses;
  45.  
  46. #if defined(powerc) || defined (__powerc)
  47. #pragma options align=mac68k
  48. #endif
  49. struct HInfoRec {
  50.     char                        cpuType[30];
  51.     char                        osType[30];
  52. };
  53. #if defined(powerc) || defined(__powerc)
  54. #pragma options align=reset
  55. #endif
  56.  
  57. typedef struct HInfoRec HInfoRec;
  58.  
  59. #if defined(powerc) || defined (__powerc)
  60. #pragma options align=mac68k
  61. #endif
  62. struct MXRec {
  63.     unsigned short                preference;
  64.     char                        exchange[255];
  65. };
  66. #if defined(powerc) || defined(__powerc)
  67. #pragma options align=reset
  68. #endif
  69.  
  70. typedef struct MXRec MXRec;
  71.  
  72. #if defined(powerc) || defined (__powerc)
  73. #pragma options align=mac68k
  74. #endif
  75. struct returnRec {
  76.     long                        rtnCode;
  77.     char                        cname[255];
  78.     union {
  79.         unsigned long                addr[NUM_ALT_ADDRS];
  80.         struct HInfoRec                hinfo;
  81.         struct MXRec                mx;
  82.     } rdata;
  83. };
  84. #if defined(powerc) || defined(__powerc)
  85. #pragma options align=reset
  86. #endif
  87.  
  88. typedef struct returnRec returnRec;
  89.  
  90. #if defined(powerc) || defined (__powerc)
  91. #pragma options align=mac68k
  92. #endif
  93. struct cacheEntryRecord {
  94.     char                        *cname;
  95.     unsigned short                type;
  96.     unsigned short                cacheClass;
  97.     unsigned long                ttl;
  98.     union {
  99.         char                        *name;
  100.         ip_addr                        addr;
  101.     } rdata;
  102. };
  103. #if defined(powerc) || defined(__powerc)
  104. #pragma options align=reset
  105. #endif
  106.  
  107. typedef struct cacheEntryRecord cacheEntryRecord;
  108.  
  109. #ifdef __cplusplus
  110. extern "C" {
  111. #endif
  112.  
  113. typedef pascal void (*EnumResultProcPtr)(struct cacheEntryRecord *cacheEntryRecordPtr, char *userDataPtr);
  114.  
  115. enum {
  116.     uppEnumResultProcInfo = kPascalStackBased
  117.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct cacheEntryRecord*)))
  118.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
  119. };
  120.  
  121. #if USESROUTINEDESCRIPTORS
  122. typedef UniversalProcPtr EnumResultUPP;
  123.  
  124. #define CallEnumResultProc(userRoutine, cacheEntryRecordPtr, userDataPtr)        \
  125.         CallUniversalProc((UniversalProcPtr)userRoutine, uppEnumResultProcInfo, cacheEntryRecordPtr, userDataPtr)
  126. #define NewEnumResultProc(userRoutine)        \
  127.         (EnumResultUPP) NewRoutineDescriptor((ProcPtr)userRoutine, uppEnumResultProcInfo, GetCurrentISA())
  128. #else
  129. typedef EnumResultProcPtr EnumResultUPP;
  130.  
  131. #define CallEnumResultProc(userRoutine, cacheEntryRecordPtr, userDataPtr)        \
  132.         (*userRoutine)(cacheEntryRecordPtr, userDataPtr)
  133. #define NewEnumResultProc(userRoutine)        \
  134.         (EnumResultUPP)(userRoutine)
  135. #endif
  136.  
  137. typedef pascal void (*ResultProcPtr)(struct hostInfo *hostInfoPtr, char *userDataPtr);
  138.  
  139. enum {
  140.     uppResultProcInfo = kPascalStackBased
  141.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct hostInfo*)))
  142.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
  143. };
  144.  
  145. #if USESROUTINEDESCRIPTORS
  146. typedef UniversalProcPtr ResultUPP;
  147.  
  148. #define CallResultProc(userRoutine, hostInfoPtr, userDataPtr)        \
  149.         CallUniversalProc((UniversalProcPtr)userRoutine, uppResultProcInfo, hostInfoPtr, userDataPtr)
  150. #define NewResultProc(userRoutine)        \
  151.         (ResultUPP) NewRoutineDescriptor((ProcPtr)userRoutine, uppResultProcInfo, GetCurrentISA())
  152. #else
  153. typedef ResultProcPtr ResultUPP;
  154.  
  155. #define CallResultProc(userRoutine, hostInfoPtr, userDataPtr)        \
  156.         (*userRoutine)(hostInfoPtr, userDataPtr)
  157. #define NewResultProc(userRoutine)        \
  158.         (ResultUPP)(userRoutine)
  159. #endif
  160.  
  161. typedef pascal void (*ResultProc2ProcPtr)(struct returnRec *returnRecPtr, char *userDataPtr);
  162.  
  163. enum {
  164.     uppResultProc2ProcInfo = kPascalStackBased
  165.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(struct returnRec*)))
  166.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
  167. };
  168.  
  169. #if USESROUTINEDESCRIPTORS
  170. typedef UniversalProcPtr ResultProc2UPP;
  171.  
  172. #define CallResultProc2Proc(userRoutine, returnRecPtr, userDataPtr)        \
  173.         CallUniversalProc((UniversalProcPtr)userRoutine, uppResultProc2ProcInfo, returnRecPtr, userDataPtr)
  174. #define NewResultProc2Proc(userRoutine)        \
  175.         (ResultProc2UPP) NewRoutineDescriptor((ProcPtr)userRoutine, uppResultProc2ProcInfo, GetCurrentISA())
  176. #else
  177. typedef ResultProc2ProcPtr ResultProc2UPP;
  178.  
  179. #define CallResultProc2Proc(userRoutine, returnRecPtr, userDataPtr)        \
  180.         (*userRoutine)(returnRecPtr, userDataPtr)
  181. #define NewResultProc2Proc(userRoutine)        \
  182.         (ResultProc2UPP)(userRoutine)
  183. #endif
  184.  
  185. typedef ResultProc2ProcPtr ResultProc2Ptr;
  186.  
  187. extern OSErr OpenResolver(char *fileName);
  188. extern OSErr StrToAddr(char *hostName, struct hostInfo *hostInfoPtr, ResultUPP ResultProc, char *userDataPtr);
  189. extern OSErr AddrToStr(unsigned long addr, char *addrStr);
  190. extern OSErr EnumCache(EnumResultUPP enumResultProc, char *userDataPtr);
  191. extern OSErr AddrToName(ip_addr addr, struct hostInfo *hostInfoPtr, ResultUPP ResultProc, char *userDataPtr);
  192. extern OSErr HInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr);
  193. extern OSErr MXInfo(char *hostName, struct returnRec *returnRecPtr, ResultProc2Ptr resultProc, char *userDataPtr);
  194. extern OSErr CloseResolver(void);
  195. #ifdef __cplusplus
  196. }
  197. #endif
  198.  
  199. #endif
  200.  
  201.